package com.bzkj.web.controller.ncc;

import com.bzkj.basicinfo.domain.ncc.NccBasicReducedUnit;
import com.bzkj.basicinfo.domain.ncc.dto.NccBasicReducedUnitDto;
import com.bzkj.basicinfo.service.ncc.NccBasicReducedUnitService;
import com.bzkj.common.core.controller.BaseController;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Author wangzhichao
 * @ClassName NccBasicReducedUnitController
 * @Date 2024/12/09 15:30:27
 * @description Ncc物料转化系数信息
 */
@RequestMapping("ncc/basic/reducedUnit")
@RestController
public class NccBasicReducedUnitController extends BaseController
{
    @Autowired
    private NccBasicReducedUnitService nccBasicReducedUnitService;

    /**
     * 根据条件分页查询数据
     *
     * @Author wangzhichao
     * @Date 2024/12/09 15:48:37
     * @Param dto
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:query')")
    @GetMapping("findNccBasicReducedUnitData")
    public TableDataInfo findNccBasicReducedUnitData(NccBasicReducedUnitDto dto)
    {
        startPage();
        return getDataTable(nccBasicReducedUnitService.findNccBasicReducedUnitData(dto));
    }

    /**
     * 根据pk_material修改信息
     *
     * @Author wangzhichao
     * @Date 2024/12/09 16:21:41
     * @Param entity
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:edit')")
    @PutMapping("nccBasicReducedUnitUpdate")
    public AjaxResult nccBasicReducedUnitUpdate(@RequestBody NccBasicReducedUnit entity)
    {
        return nccBasicReducedUnitService.nccBasicReducedUnitUpdate(entity);
    }

    /**
     * 新增换算系数信息
     *
     * @Author wangzhichao
     * @Date 2024/12/10 10:57:15
     * @Param entity
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:add')")
    @PostMapping("nccBasicReducedUnitSave")
    public AjaxResult nccBasicReducedUnitSave(@RequestBody NccBasicReducedUnit entity)
    {
        return nccBasicReducedUnitService.nccBasicReducedUnitSave(entity);
    }

    /**
     * 定时任务
     * @return
     */
    @GetMapping("jobMethod")
    public R jobMethod()
    {
        return nccBasicReducedUnitService.jobMethodExecute(false);
    }


}
